﻿using System;
using System.Text;

// Write a program that extracts from given HTML file its title (if available), and its body text without the HTML tags.

namespace StripTags
{
    class StripTags
    {
        static void Main()
        {
            string text = "<html><head><title>News</title></head><body><p><a href=\"http://academy.telerik.com\">Telerik Academy</a>aims to provide free real-world practical training for young people who want to turn into skillful .NET software engineers.</p></body></html>";
            StringBuilder result = new StringBuilder();

            for (int index = 0, length = text.Length; index < length; index++)
            {
                if (text[index] == '<') //if found a open tag
                {
                    /* while we are inside the tag */
                    while (text[index] != '>')
                    {
                        index++;
                    }
                    continue;
                }

                result.Append(text[index]);
            }

            Console.WriteLine(result);
        }
    }
}
